/*
 * @Author: zhangchaosen
 * @Date: 2024-05-20 09:29:53
 * @LastEditors: zhangchaosen
 * @LastEditTime: 2024-06-19 13:51:21
 * @Description: 静态路由
 */
import { RouteRecordRaw } from 'vue-router'

const Layout = () => import('@/layout/index.vue')

/**
 * @description 公共路由
 */
export const publicRoute: RouteRecordRaw[] = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        name: 'HomePage',
        meta: { title: '首页', icon: 'home', isAffix: true },
        component: () => import('@/views/home/index.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    meta: { title: '登录', hidden: true },
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/redirect',
    component: Layout,
    meta: { hidden: true },
    children: [
      {
        path: '/redirect/:path(.*)',
        name: 'Redirect',
        component: () => import('@/views/redirect/index.vue')
      }
    ]
  }
]

/**
 * @description 错误路由
 */
export const errorRouter = [
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/public/error-page/404.vue'),
    meta: {
      title: '404页面',
      hidden: true
    }
  },
  // Resolve refresh page, route warnings
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/public/error-page/404.vue')
  }
]

export default publicRoute
